{"componentChunkName":"component---node-modules-rocketseat-gatsby-theme-docs-core-src-templates-docs-query-js","path":"/manual-review/PurchaseSkeletonNID-PSI","result":{"data":{"mdx":{"id":"b9995479-6497-5df0-a755-63756710ea2e","excerpt":"PSI-01M: Incompatible Integration of Fractionalized EIP-1155 ODC Implementation Type Severity Location Logical Fault PurchaseSkeletonNID.sol:L75-L79 Description…","fields":{"slug":"/manual-review/PurchaseSkeletonNID-PSI/"},"frontmatter":{"title":"PurchaseSkeletonNID Manual Review Findings","description":"Contains all the findings that relate to manual review on the contract codebase","image":null,"disableTableOfContents":null},"body":"var _excluded = [\"components\"];\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsxRuntime classic */\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"title\": \"PurchaseSkeletonNID Manual Review Findings\",\n  \"description\": \"Contains all the findings that relate to manual review on the contract codebase\"\n};\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, _excluded);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"h2\", {\n    \"id\": \"span-idpsi-01mpsi-01m-incompatible-integration-of-fractionalized-eip-1155-odc-implementationspan\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h2\",\n    \"href\": \"#span-idpsi-01mpsi-01m-incompatible-integration-of-fractionalized-eip-1155-odc-implementationspan\",\n    \"aria-label\": \"span idpsi 01mpsi 01m incompatible integration of fractionalized eip 1155 odc implementationspan permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), mdx(\"span\", {\n    id: \"PSI-01M\"\n  }, \"PSI-01M: Incompatible Integration of Fractionalized EIP-1155 ODC Implementation\")), mdx(\"table\", null, mdx(\"thead\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"thead\"\n  }, mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Type\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Severity\"), mdx(\"th\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, \"Location\"))), mdx(\"tbody\", {\n    parentName: \"table\"\n  }, mdx(\"tr\", {\n    parentName: \"tbody\"\n  }, mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"a\", {\n    parentName: \"td\",\n    \"href\": \"/reports/evergon-labs-tokenizer-6763f6df7b5d3d00195ae534/appendix/finding-types#logical-fault\"\n  }, \"Logical Fault\")), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"img\", {\n    parentName: \"td\",\n    \"className\": \"o-severity o-major\",\n    \"src\": \"https://omniscia.io/report-assets/major.png\"\n  })), mdx(\"td\", {\n    parentName: \"tr\",\n    \"align\": null\n  }, mdx(\"a\", {\n    parentName: \"td\",\n    \"href\": \"https://github.com/evergonlabs/TMI-tokenizer/blob/3bf02f23825484f7fabe1671684226bc2ed2aea9/packages/contracts/contracts/skeletonFacets/NID/PurchaseSkeletonNID.sol#L75-L79\"\n  }, \"PurchaseSkeletonNID.sol:L75-L79\"))))), mdx(\"h3\", {\n    \"id\": \"description\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#description\",\n    \"aria-label\": \"description permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Description:\"), mdx(\"p\", null, \"The \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://github.com/evergonlabs/TMI-tokenizer/blob/3bf02f23825484f7fabe1671684226bc2ed2aea9/packages/contracts/contracts/skeletonFacets/NID/PurchaseSkeletonNID.sol#L56-L89\"\n  }, mdx(\"inlineCode\", {\n    parentName: \"a\"\n  }, \"PurchaseSkeletonNID::purchase\")), \" function integrates with the Evergon Labs ODC fractionalized \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://eips.ethereum.org/EIPS/eip-1155\"\n  }, \"EIP-1155\"), \" implementation to permit a mint-on-purchase approach.\"), mdx(\"p\", null, \"This approach is inherently insecure as the first purchaser of a campaign will be able to directly interact with the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"FractionERC1155DataManager::fullyUnlockWrappedAssets\"), \" to acquire the underlying assets, effectively stealing all wrapped funds of a campaign for the price of a single fraction.\"), mdx(\"h3\", {\n    \"id\": \"impact\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#impact\",\n    \"aria-label\": \"impact permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Impact:\"), mdx(\"p\", null, \"It is possible to fully unwrap the underlying assets of a fractionalized \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://eips.ethereum.org/EIPS/eip-1155\"\n  }, \"EIP-1155\"), \" implementation by directly interacting with the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"FractionERC1155DataManager\"), \", effectively acquiring all wrapped funds for the price of a single fraction.\"), mdx(\"h3\", {\n    \"id\": \"example\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#example\",\n    \"aria-label\": \"example permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Example:\"), mdx(\"pre\", null, mdx(\"code\", {\n    parentName: \"pre\",\n    \"className\": \"language-sol\",\n    \"metastring\": \"title=packages/contracts/contracts/skeletonFacets/NID/PurchaseSkeletonNID.sol highlight={20,21,22,23,24} lineNumbers=true lineOffset=55\",\n    \"title\": \"packages/contracts/contracts/skeletonFacets/NID/PurchaseSkeletonNID.sol\",\n    \"highlight\": \"{20,21,22,23,24}\",\n    \"lineNumbers\": \"true\",\n    \"lineOffset\": \"55\"\n  }, \"function purchase(\\n    uint256 campaignId,\\n    uint256 amountOfFractions,\\n    bytes calldata discountOperationData,\\n    bytes calldata postPurchaseData,\\n    uint32 chainId\\n) external payable onlyExternalDelegateCall requireTxDataAuth {\\n    IPurchaseStateFacet(address(this)).checkPurchaseState(campaignId);\\n    IPurchaseTimeFacet(address(this)).checkPurchaseTimes(campaignId);\\n\\n    address account = ERC2771RecipientStorage.layout()._msgSender();\\n    IPurchaseAmountFacet(address(this)).checkPurchaseAmounts(campaignId, amountOfFractions, account);\\n    uint256 discountPercentage = IPurchaseDiscountFacet(address(this)).getDiscount(\\n        campaignId,\\n        amountOfFractions,\\n        account,\\n        discountOperationData\\n    );\\n    IDoPurchaseFacet(address(this)).doPurchase(campaignId, account, amountOfFractions, discountPercentage);\\n    if (GeneralStorage.layout().infoForId[campaignId].isMinting) {\\n        // Mint to the diamond and then transfers etc will be handled by postPurchase\\n        // Always mint id 0 if semi fungible. All other ids are used only for vesting in current version.\\n        ISemiFungibleAndFungibleFractionTransferFacet(address(this)).mintFractions(campaignId, address(this), 0, amountOfFractions);\\n    }\\n    IPostPurchaseFacet(address(this)).handlePostPurchasePhase{value: msg.value}(\\n        campaignId,\\n        amountOfFractions,\\n        chainId,\\n        account,\\n        postPurchaseData\\n    );\\n\\n    emit FractionsPurchased(campaignId, account, amountOfFractions);\\n}\\n\")), mdx(\"h3\", {\n    \"id\": \"recommendation\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#recommendation\",\n    \"aria-label\": \"recommendation permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Recommendation:\"), mdx(\"p\", null, \"We advise the system's integration to be revised, potentially by updating either the \", mdx(\"inlineCode\", {\n    parentName: \"p\"\n  }, \"FractionERC1155DataManager\"), \" itself in the ODC repository or removing support for mint-on-purchase configurations.\"), mdx(\"h3\", {\n    \"id\": \"alleviation-71cda4ccfdcfa25fb96a4565f1f8143b350dd246\",\n    \"style\": {\n      \"position\": \"relative\"\n    }\n  }, mdx(\"a\", {\n    parentName: \"h3\",\n    \"href\": \"#alleviation-71cda4ccfdcfa25fb96a4565f1f8143b350dd246\",\n    \"aria-label\": \"alleviation 71cda4ccfdcfa25fb96a4565f1f8143b350dd246 permalink\",\n    \"className\": \"anchor before\"\n  }, mdx(\"svg\", {\n    parentName: \"a\",\n    \"aria-hidden\": \"true\",\n    \"focusable\": \"false\",\n    \"height\": \"16\",\n    \"version\": \"1.1\",\n    \"viewBox\": \"0 0 16 16\",\n    \"width\": \"16\"\n  }, mdx(\"path\", {\n    parentName: \"svg\",\n    \"fillRule\": \"evenodd\",\n    \"d\": \"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"\n  }))), \"Alleviation (71cda4ccfdcfa25fb96a4565f1f8143b350dd246):\"), mdx(\"p\", null, \"The Evergon Labs team evaluated this exhibit and proceeded to update the ODC implementations to permit the deployment of an \", mdx(\"a\", {\n    parentName: \"p\",\n    \"href\": \"https://eips.ethereum.org/EIPS/eip-1155\"\n  }, \"EIP-1155\"), \" fraction to define whether user unlocks are enabled.\"), mdx(\"p\", null, \"This mechanism permits user unlocks to be disabled and thus the system to be compatible with a mint-on-purchase approach as the callback will not be able to extract funds at will.\"), mdx(ViewDiffButton, {\n    repoUrl: \"https://github.com/evergonlabs/TMI-tokenizer\",\n    mainHash: \"3bf02f23825484f7fabe1671684226bc2ed2aea9\",\n    fixHash: \"71cda4ccfdcfa25fb96a4565f1f8143b350dd246\",\n    gitHubIssue: \"145\",\n    mdxType: \"ViewDiffButton\"\n  }));\n}\n;\nMDXContent.isMDXComponent = true;","headings":[{"depth":2,"value":"<span id=\"PSI-01M\">PSI-01M: Incompatible Integration of Fractionalized EIP-1155 ODC Implementation</span>"},{"depth":3,"value":"Description:"},{"depth":3,"value":"Impact:"},{"depth":3,"value":"Example:"},{"depth":3,"value":"Recommendation:"},{"depth":3,"value":"Alleviation (71cda4ccfdcfa25fb96a4565f1f8143b350dd246):"}]}},"pageContext":{"slug":"/manual-review/PurchaseSkeletonNID-PSI/","prev":{"label":"PurchaseSkeleton.sol (PSN-M)","link":"/manual-review/PurchaseSkeleton-PSN"},"next":{"label":"PurchaseToReceiveRoleApprovalFacetStorage.sol (PTA-M)","link":"/manual-review/PurchaseToReceiveRoleApprovalFacetStorage-PTA"}}},"staticQueryHashes":["1954253342","2328931024","2501019404","973074209"]}